<?php
    $pid = Yii::app()->request->getParam("pid");
    $nid = Yii::app()->request->getParam("nid");
?>   

<script type="text/javascript">
	$(document).ready(function() {
		// load comment
		$(document).ready(function(){
			$("#comment-wrapper").load('<?php echo $this->createUrl('/comment/index',array('pid'=>$pid,'oid'=>$nid,'ctype'=>'NOTEBOOK'))?>'	);
		});
		
		$(".popupCancel").click(function() {
			$.fancybox.close();
			});
                
                $("form").submit(function(){
                        $.ajax({
                            url: '<?php echo $this->createUrl('notebooks/createComment'); ?>',
                            type: 'POST',
                            data: {
                                pid:<?php echo $pid; ?>,
                                nid:<?php echo $nid; ?>,
                                commentBody:$("#commentbody").val()
                            },
                            success: function(data){
                                $(".nbCommentWrapper").append(data);
                                commentCount = parseInt($("#comment-count").text());
                                $("#comment-count").text(commentCount+1);
                                $.fancybox.close();
                            },
                            error: function(){
                                alert("An error occured, please try again later");
                            }
                        });
                        return false;
                });
        
        });
	
</script>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/notebook.css" />
<div class="clear"></div>


		<div id="than">	
           	 <img src="<?php echo Html::imageUrl("muiten.png");?>" width="27" height="26"; style="float:left">
            	<div id="textxanhdam"> Tasks </div>	
			</div>
	
            <div class="padding15"></div>
             	           	
	             	<!-- Begin leftSidebar-->   
					<div id="leftSidebar">
						<div id="leftWrapper">
						</div>
					</div>
					<!-- End leftSidebar -->
					
					<!-- Begin rightSidebar -->
					<div id="rightSidebar">
						<div id="rightHeader">
								<h3><?php echo $notebook->notebook_name; ?></h3> in 
                                                                <a href ="<?php echo $this->createUrl('/notebooks/index', array("pid"=>$pid,"#"=>"notebookWrapper-{$notebook->notebook_category_id}"))?>">
                                                                        <?php echo $notebook->notebookCategory->notebook_category_name; ?>
                                                                </a>
								by <a href=""><?php echo $notebook->notebookPostedByUser->user_name;?></a> at <?php echo Html::formatTime($notebook->notebook_created_date);echo " "; echo Html::formatDate($notebook->notebook_created_date);?>
						</div>
						
						<!-- Begin rightWrapper -->
						<div id="rightWrapper">
							<div class="nbFrame">
								<div class="nbBody">
									<p>
										<?php echo $notebook->notebook_content; ?>
									 </p>
								</div>
							</div>
							<div class="editNotebook">
								<button class="editNotebookBtn" onclick="javascript:window.location ='<?php echo Yii::app()->controller->createUrl("notebooks/edit",array("pid"=>$pid,"nid"=>$nid));?>'">Edit this notebook</button>
							</div>
							<div class="padding20"></div>
							
							<div id="comment-wrapper">
									<!--  Load by jquery -->
							</div>
						</div>
                                                
						<!-- End rightWrapper -->
					</div>
					<!-- End rightSidebar -->
                                        
					
    </div>
    
    
    
    
    
